package cn.exrick.xboot.shop.utils;

import cn.exrick.xboot.shop.entity.ShopComment;

import java.util.List;

public class ArticleUtils {


    /**
     * 评论数量
     * @param comments
     */
    public static void commentNum(List<ShopComment> comments){
        for(ShopComment comment: comments){
            if(!comment.getChildren().isEmpty() && comment.getChildren().size() > 0){
                comment.setReplayNum(comment.getChildren().size());
                commentNum(comment.getChildren());
            }else{
                comment.setReplayNum(0);
            }
        }
    }

}
